<?php
/* 
	[BuyPg] (C) 2010-2011 Buypg
	$Id: YouhuiCommentAction.php 2011-12-26 10:36:18 wufujun $
 */
if (!defined('THINK_PATH')){
	exit('Access Denied');
}

class YouhuiCommentAction extends BpAction{
	function _filter(&$map){
		$map['title'] = array('like',"%".$_POST['title']."%");
	}
	
	public function _before_insert(){
		//判断用户ID与用户名
		$User = M("User");
		$UserID = $_POST['authorid'];
		$UserName = $_POST['author'];
		$list = $User->where("user_id = $UserID")->find();
		if($list['user_nickname'] != $UserName){
			$this->error('用户名与用户ID不匹配！');
		}
	}
	
	public function _before_update(){
		//判断用户ID与用户名
		$User = M("User");
		$UserID = $_POST['authorid'];
		$UserName = $_POST['author'];
		$list = $User->where("user_id = $UserID")->find();
		if($list['user_nickname'] != $UserName){
			$this->error('用户名与用户ID不匹配！');
		}

		//处理更新日期
		$_POST['dateline'] = strtotime($_POST['dateline']);
	}
}
?>
